import TaskStateEnum from '@model/enum/TaskStateEnum.ts';
import i18n from '@src/locales'

type TaskState = {
  name: string,
  value: string | string[]
}

class TaskStateProcessEnum {

  CREATED: TaskState
  ALLOCATED: TaskState
  ACCEPTED: TaskState
  PROCESSING: TaskState
  FINISHED: TaskState
  OFFED: TaskState
  DRAFT: TaskState

  constructor(){

    this.CREATED = {
      name: i18n.t('task.taskTypes.planTask.toBeAllot') as string,
      value: [
        TaskStateEnum.CREATED.value, 
        TaskStateEnum.TASK_POOL.value,
        TaskStateEnum.REFUSED.value
      ]
    }

    this.ALLOCATED = {
      name: i18n.t('common.task.type.allocated') as string,
      value: TaskStateEnum.ALLOCATED.value
    }

    this.ACCEPTED = {
      name: i18n.t('common.task.type.accepted') as string,
      value: TaskStateEnum.ACCEPTED.value
    }
    
    this.PROCESSING = {
      name: i18n.t('common.task.type.processing') as string,
      value: TaskStateEnum.PROCESSING.value
    }

    this.FINISHED = {
      name: i18n.t('common.task.type.finished') as string,
      value: [
        TaskStateEnum.FINISHED.value,
        TaskStateEnum.COSTED.value,
        TaskStateEnum.CLOSED.value
      ]
    }

    this.OFFED = {
      name: i18n.t('common.task.type.offed') as string,
      value: TaskStateEnum.OFFED.value
    }

    this.DRAFT = {
      name: TaskStateEnum.DRAFT.name,
      value: TaskStateEnum.DRAFT.value
    }

  }

}

export default new TaskStateProcessEnum();